package lesson5;

import javax.management.ObjectName;
import java.util.Objects;

public class Student extends Person{
    private String stuId;
    public Student(){

    }

    public Student(String stuId) {
        this.stuId = stuId;
    }

    public Student(String name,int age, String stuId) {
        super(name,age);
        this.stuId = stuId;
    }

    @Override
    public boolean equals(Object o){
        if(this == o){
            return true;
        }

        if(o instanceof Student){
            Student student = (Student) o;
            if(this.stuId.equals(student.stuId)&&super.equals(student)){
                return true;
            }
        }
        return false;
    }



    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), stuId);
    }

    public String getStuId() {
        return stuId;
    }

    public void setStuId(String stuId) {
        this.stuId = stuId;
    }

    @Override
    public String toString() {
        return "Student{" +
                super.toString()+
                "stuId='" + stuId + '\'' +
                '}';
    }
}
